package com.gitee.wsl.time.schedule.adapter

import com.gitee.wsl.coroutines.Queued

object SchedulerContract {
     data class State<I : Any, E : Any, S : Any>(
        val schedules: Map<String, ScheduleState> = emptyMap()
    )

     sealed interface Inputs<I : Any, E : Any, S : Any> {
         class StartSchedules<I : Any, E : Any, S : Any>(
             val adapter: SchedulerAdapter<I, E, S>
        ) : Inputs<I, E, S>

         class PauseSchedule<I : Any, E : Any, S : Any>(
             val key: String
        ) : Inputs<I, E, S>

         class ResumeSchedule<I : Any, E : Any, S : Any>(
             val key: String
        ) : Inputs<I, E, S>

         class CancelSchedule<I : Any, E : Any, S : Any>(
             val key: String
        ) : Inputs<I, E, S>

         class MarkScheduleComplete<I : Any, E : Any, S : Any>(
             val key: String
        ) : Inputs<I, E, S>

         class DispatchScheduledTask<I : Any, E : Any, S : Any>(
             val key: String,
             val queued: Queued.HandleInput<I, E, S>,
        ) : Inputs<I, E, S>

         class ScheduledTaskDropped<I : Any, E : Any, S : Any>(
             val key: String,
        ) : Inputs<I, E, S>

         class ScheduledTaskFailed<I : Any, E : Any, S : Any>(
             val key: String,
        ) : Inputs<I, E, S>
    }

     sealed interface Events<I : Any, E : Any, S : Any> {
         data class PostInputToHost<I : Any, E : Any, S : Any>(
            val queued: Queued.HandleInput<I, E, S>,
        ) : Events<I, E, S>
    }
}

